import { GoodsItem } from "../common/GoodsItem";
import { GameController } from "../../mvc/GameController";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { DragManager } from "../../../../com/mui/manager/DragManager";
import { GameManager } from "../../manager/GameManager";
import { ModuleType } from "../common/ModuleType";
import { ListData } from "../../../../fl/controls/listClasses/ListData";
//class WareHouseItem
    
    export  class WareHouseItem extends GoodsItem
    {
        constructor()
        {
            super();
            _bitmap.x = 3;
            _bitmap.y = 3;
            isShowLock = true;
            this.posType = GameController.wareHouse.posType;
            return;
        }

        public /* override */ set selected(arg1: Boolean)
        {
            super.selected = arg1;
            if (arg1 && itemData) 
            {
                this.filters = [FilterConst.itemChooseFilter];
            }
            else 
            {
                this.filters = [];
            }
            return;
        }

        protected /* override */ resetBitmapSize(): void
        {
            if (_bitmap) 
            {
                _bitmap.width = _width - 4;
                _bitmap.height = _height - 4;
            }
            return;
        }

        protected /* override */ onMouseDown(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (itemData) 
            {
                DragManager.instance.startDragItem(this);
            }
            else if (!this.isOpened) 
            {
                GameManager.instance.popupWindow(ModuleType.WareHouseBuyItem);
            }
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            this.isOpened = arg1["isOpened"];
            this.selected = arg1["selected"];
            if (arg1.hasOwnProperty("itemData")) 
            {
                this.itemData = arg1["itemData"];
            }
            else 
            {
                this.itemData = null;
            }
            return;
        }

        public /* override */ set listData(arg1: ListData)
        {
            super.listData = arg1;
            this.posIndex = listData.index + 1;
            return;
        }

        /* internal */ /* var */isOpened: Boolean=true;
    }
